<?php
/**
 * Created by PhpStorm.
 * User: jihaichuan
 * Date: 2018/10/15
 * Time: 上午11:10
 */
namespace app\admin\controller;

use think\Controller;
use think\Db;

class Test extends Basic
{

    public function t(){
      json_success(  encode('13791'));
    }


    /**
     * 关联省份ID
     */
    public function city_province(){
        $list = Db('Province')->select();

        foreach ($list as $k=>$v){
            $ids = Db('City')->where(array('father'=>$v['province_code']))->column('id');

            Db('City')->where(array('id'=>array('in',$ids)))->update(array('province_id'=>$v['id']));
        }

        echo 1;
    }

    /**
     * 关联城市ID
     */
    public function area_city(){
        $list = Db('City')->select();

        foreach ($list as $k=>$v){
            $ids = Db('Area')->where(array('father'=>$v['city_code']))->column('id');

            Db('Area')->where(array('id'=>array('in',$ids)))->update(array('city_id'=>$v['id']));
        }

        echo 1;
    }

    /**
     * 生成二维码
     */
    public function aa(){
        $this->get_qr_code();
    }
}
